import Login from './components/Login'

const routes = [
  {
    path: '/',
    component: Login,
    meta: {noAuth: true}
  }, {
    path: '/main',
    component: (resolve) => {
      require(['./components/Main'], resolve)
    },
    children: [
      // 首页
      {
        path: '/home',
        component: (resolve) => {
          require(['./components/Home'], resolve)
        }
      },
      // 客户信息
      {
        path: '/customer',
        component: (resolve) => {
          require(['./components/crm/customer/Customers'], resolve)
        }
      }, {
        path: '/customer/:id',
        name: 'customerDetail',
        component: (resolve) => {
          require(['./components/crm/customer/CustomerDetail'], resolve)
        }
      }, {
        path: '/customer/:customerid/orgs',
        name: 'customerOrgs',
        component: (resolve) => {
          require(['./components/crm/organization/Organizations'], resolve)
        }
      },
      // 组织信息
      {
        path: '/organization',
        component: (resolve) => {
          require(['./components/crm/organization/Organizations'], resolve)
        }
      }, {
        path: '/organization/:id',
        name: 'organizationDetail',
        component: (resolve) => {
          require(['./components/crm/organization/OrganizationDetail'], resolve)
        }
      },
      {
        path: '/user',
        component: (resolve) => {
          require(['./components/sys/user/Users'], resolve)
        }
      }, {
        path: '/user/:id',
        name: 'm-u-d',
        component: (resolve) => {
          require(['./components/sys/user/UserDetail'], resolve)
        }
      }, {
        path: '/role',
        component: (resolve) => {
          require(['./components/sys/role/Roles'], resolve)
        }
      }, {
        path: '/role/:id',
        name: 'm-r-d',
        component: (resolve) => {
          require(['./components/sys/role/RoleDetail'], resolve)
        }
      }, {
        path: '/role/:id/authority',
        name: 'm-r-d-a',
        component: (resolve) => {
          require(['./components/sys/role/RoleRights'], resolve)
        }
      }, {
        path: '/menu',
        component: (resolve) => {
          require(['./components/sys/menu/Menus'], resolve)
        }
      }, {
        path: '/right',
        component: (resolve) => {
          require(['./components/sys/right/Rights'], resolve)
        }
      }, {
        path: '/dict',
        component: (resolve) => {
          require(['./components/sys/dict/Dicts'], resolve)
        }
      },
      // 省份
      {
        path: '/province',
        component: (resolve) => {
          require(['./components/sys/province/Provinces'], resolve)
        }
      }, {
        path: '/province/:provinceid/citys',
        name: 'provinceCitys',
        component: (resolve) => {
          require(['./components/sys/province/Citys'], resolve)
        }
      }, {
        path: '/province/:provinceid/city/:cityid/areas',
        name: 'cityAreas',
        component: (resolve) => {
          require(['./components/sys/province/Citys'], resolve)
        }
      },
      // 工程师
      {
        path: '/engineer',
        component: (resolve) => {
          require(['./components/engineer/baseinfo/Engineers'], resolve)
        }
      }, {
        path: '/engineer/:id',
        component: (resolve) => {
          require(['./components/engineer/baseinfo/EngineerDetail'], resolve)
        }
      }
    ]
  }, {
    path: '*',
    component: (resolve) => {
      require(['./components/NotFound'], resolve)
    }
  }
]

export default routes
